<!DOCTYPE html>
<html>

<head>
    <title>登录</title>
    <style>
        body {
            background-color: #f5f5f5;
            font-family: Arial, sans-serif;
            margin: 0;
            padding: 20px;
            min-height: 100vh;
            display: flex;
            align-items: center;
            justify-content: center;
            background: linear-gradient(120deg, #a1c4fd 0%, #c2e9fb 100%);
        }

        .login-container {
            max-width: 400px;
            width: 90%;
            padding: 20px;
            background: white;
            border-radius: 8px;
            box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
        }

        h1 {
            text-align: center;
            color: #333;
            margin-bottom: 30px;
            font-size: 28px;
            font-weight: 600;
        }

        .form-group {
            margin-bottom: 20px;
            position: relative;
        }

        .form-group label {
            display: block;
            margin-bottom: 5px;
            color: #555;
            font-weight: 500;
            font-size: 14px;
        }

        .form-group input {
            width: 100%;
            padding: 12px;
            border: 1px solid #ddd;
            border-radius: 4px;
            box-sizing: border-box;
            font-size: 14px;
            transition: all 0.3s ease;
        }

        .form-group input:focus {
            border-color: #007bff;
            box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
            outline: none;
        }

        .error-message {
            color: #dc3545;
            margin-bottom: 15px;
            text-align: center;
            padding: 10px;
            background-color: #fff5f5;
            border-radius: 4px;
            font-size: 14px;
        }

        button {
            width: 100%;
            padding: 12px;
            background-color: #007bff;
            color: white;
            border: none;
            border-radius: 4px;
            cursor: pointer;
            font-size: 16px;
            font-weight: 500;
            transition: all 0.3s ease;
        }

        button:hover {
            background-color: #0056b3;
            transform: translateY(-1px);
            box-shadow: 0 4px 12px rgba(0, 123, 255, 0.15);
        }

        button:active {
            transform: translateY(0);
        }

        .register-link {
            text-align: center;
            margin-top: 15px;
        }

        .register-link a {
            color: #007bff;
            text-decoration: none;
        }

        .register-link a:hover {
            text-decoration: underline;
        }

        .forgot-password {
            text-align: right;
            margin-bottom: 15px;
        }

        .forgot-password a {
            color: #6c757d;
            text-decoration: none;
            font-size: 14px;
        }

        .forgot-password a:hover {
            color: #007bff;
        }

        .modal {
            display: none;
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background-color: rgba(0, 0, 0, 0.5);
            z-index: 1000;
        }

        .modal-content {
            position: relative;
            background-color: #fff;
            margin: 15% auto;
            padding: 20px;
            width: 80%;
            max-width: 500px;
            border-radius: 8px;
            box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
        }

        .modal-close {
            position: absolute;
            right: 20px;
            top: 10px;
            font-size: 24px;
            cursor: pointer;
            color: #666;
        }

        .contact-methods {
            margin: 20px 0;
        }

        .contact-methods p {
            margin: 10px 0;
            color: #666;
        }

        .contact-methods a {
            color: #007bff;
            text-decoration: none;
        }

        .work-time {
            margin-top: 20px;
            padding-top: 15px;
            border-top: 1px solid #eee;
            color: #666;
            font-size: 14px;
        }

        /* 密码框容器样式 */
        .password-container {
            position: relative;
            width: 100%;
        }

        /* 眼睛图标样式 */
        .password-toggle {
            position: absolute;
            right: 10px;
            top: 50%;
            transform: translateY(-50%);
            cursor: pointer;
            color: #666;
            padding: 5px;
            z-index: 1;
        }

        .password-toggle:hover {
            color: #333;
        }
    </style>
</head>

<body>
    <div class="login-container">
        <h1>登录</h1>
        <% if (locals.error) { %>
            <div class="error-message">
                <%= error %>
            </div>
            <% } %>
                <form action="/login" method="POST">
                    <div class="form-group">
                        <label>用户名：</label>
                        <input type="text" name="username" required>
                    </div>
                    <div class="form-group">
                        <label>密码：</label>
                        <div class="password-container">
                            <input type="password" name="password" required>
                            <span class="password-toggle" onclick="togglePassword(this)">👁️</span>
                        </div>
                    </div>
                    <div class="forgot-password">
                        <a href="javascript:void(0)" onclick="showForgotPasswordModal()">忘记密码？</a>
                    </div>
                    <button type="submit">登录</button>
                </form>
                <div class="register-link">
                    <p>还没有账号？<a href="/register">注册</a></p>
                </div>
    </div>

    <!-- 忘记密码弹窗 -->
    <div id="forgotPasswordModal" class="modal">
        <div class="modal-content">
            <span class="modal-close" onclick="closeModal()">&times;</span>
            <h3>忘记密码？请通过以下方式联系我们（小邓的笔记本）：</h3>
            <div class="contact-methods">
                <p>1. 携带有效证件到线下服务台重置密码</p>
                <p>2. 发送邮件至：<a href="mailto:support@example.com">support@example.com</a></p>
                <p>3. 工作时间致电：<span>123-4567-8900</span></p>
                <p>4. 访问官网：<a href="http://www.example.com" target="_blank">www.example.com</a></p>
            </div>
            <div class="work-time">
                <i>⏰</i> 工作时间：周一至周五 9:00-17:00
            </div>
        </div>
    </div>

    <script>
        function showForgotPasswordModal() {
            document.getElementById('forgotPasswordModal').style.display = 'block';
        }

        function closeModal() {
            document.getElementById('forgotPasswordModal').style.display = 'none';
        }

        // 点击模态框外部关闭
        window.onclick = function (event) {
            var modal = document.getElementById('forgotPasswordModal');
            if (event.target == modal) {
                modal.style.display = 'none';
            }
        }

        function togglePassword(element) {
            const input = element.previousElementSibling;
            if (input.type === 'password') {
                input.type = 'text';
                element.textContent = '👁️‍🗨️';
            } else {
                input.type = 'password';
                element.textContent = '👁️';
            }
        }
    </script>
</body>

</html>